import { request } from '@/request'

export const addContact = <T extends object, R = any>(
  data: T
): Promise<IResponse<R>> => {
  return request.POST<T>({ url: '/contacts/add', params: data })
}

export const getContacts = <T extends object, R = any>(
  data: T
): Promise<IResponse<IList<R>>> => {
  return request.GET({ url: '/contacts/list', params: data })
}

export const updateContact = <T extends object, R = any>(
  data: T
): Promise<IResponse<R>> => {
  return request.POST<T>({ url: '/contacts/edit', params: data })
}

export const getDefualt = <T extends object, R = any>(
  data: T
): Promise<IResponse<R>> => {
  return request.GET<T>({ url: '/contacts/contact', params: data })
}
